//package com.controller;
//
//import com.pojo.Employee;
//import com.pojo.Result;
//import com.service.EmployeeService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.Map;
//
//@RequestMapping("/employees")
//@Validated
//@RestController
//public class EmployeeController {
//    @Autowired
//    private EmployeeService employeeService;
//
//    // 新增员工
//    @PostMapping
//    public Result addEmployee(@RequestBody Employee employee) {
//        // 权限验证（示例：仅管理员可操作）
//        Map<String, Object> claims = ThreadLocalUtil.get();
//        if (!"admin".equals(claims.get("role"))) {
//            return Result.error("权限不足");
//        }
//        employeeService.add(employee);
//        return Result.success();
//    }
//
//    // 根据ID查询员工详情（包含工位和部门信息）
//    @GetMapping("/{id}")
//    public Result<Employee> getById(@PathVariable Integer id) {
//        Employee employee = employeeService.findById(id);
//        return Result.success(employee);
//    }
//
//    // 更新员工信息
//    @PutMapping
//    public Result update(@RequestBody Employee employee) {
//        employeeService.update(employee);
//        return Result.success();
//    }
//
//    // 分配工位
//    @PatchMapping("/assignWorkstation")
//    public Result assignWorkstation(@RequestParam Integer employeeId,
//                                    @RequestParam Integer workstationId) {
//        employeeService.assignWorkstation(employeeId, workstationId);
//        return Result.success();
//    }
//
//    // 离职处理
//    @PostMapping("/resign/{id}")
//    public Result resignEmployee(@PathVariable Integer id) {
//        employeeService.resign(id);
//        return Result.success();
//    }
//}